April 19, 2024, 04:11:34 am

Author Topic: [PAWNO]cmd format message problems  (Read 2504 times)

0 Members and 1 Guest are viewing this topic.

Zeke

  • Crazy Man
  • *****
  • Posts: 935
  • Country: bg
  • VC:MP and LU beta tester
    • View Profile
[PAWNO]cmd format message problems
« on: October 24, 2011, 09:26:50 pm »
So basicly the problem is the format message of the cmd its bugged.

example:

with player name typed; Officer [VU]aXXo suspected [VU_R]Zeke Reason: testke

with player ID typed; Officer [VU]aXXo suspected [VU_R]Zeke Reason: test

it add the last 2 (sometimes 3) letters of the suspects name

here is my script

Code: [Select]
else if(strcmp(cmd,"sus",true) == 0)
{
new plr;
tmp = strtok(cmdtext, idx);
plr = FindPlayerIDFromString(tmp);
new reason[256]; reason = strtok(cmdtext, idx);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
    else if(PlayerInfo[playerid][Cop] != 1) SendClientMessage(playerid, COLOR_RED, "You are not a Police officer");
else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c sus [Nick/ID] [Reason]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else if(PlayerInfo[plr][Wanted] >= 1) SendClientMessage(playerid,COLOR_RED,"Suspect is already wanted...");
else
{
new szMsg[256];
        format(szMsg,sizeof(szMsg),"Officer %s suspected %s Reason:%s",gPlayers[playerid],gPlayers[plr],cmdtext[6]);
   SendClientMessageToAll(COLOR_GREEN,szMsg);
new surmsg[256];
format(surmsg,sizeof(surmsg),"%s suspected you!!!",gPlayers[playerid]);
SendClientMessage(plr,COLOR_YELLOW,surmsg);
PlayerInfo[plr][Wanted] = 1;
}
return 1;
}

ye and i know what will all of u say "scrap it and convert it to squirrel" but NEIN ( personal reasons)




« Last Edit: October 24, 2011, 09:38:32 pm by Zeke »
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

Quote
InstallHook(0x405AC0,(DWORD)CantFindFuckingAnim,0x405A95,
CantFindFuckingAnim_HookJmpCode,sizeof(CantFindFuckingAnim_HookJmpCode));
-------------------------------------------------
Quote
[00:41:12] <~Murdock> actually just transfering files
[00:41:16] <~Murdock> sounds, clientscripts etc
[00:42:05] <heekzs> what transfer method you uses
[00:43:03] <~Murdock> speed of light

stormeus

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 1755
  • Country: us
  • VC:MP Developer
    • View Profile
    • GTA VICE CITY Respective owner
Re: [PAWNO]cmd format message problems
« Reply #1 on: October 25, 2011, 07:09:42 pm »
-------------- BEGIN HARSH CRITIQUE --------------

  • Using 256 cells for everything.
    You are really screwing your performance here, since you're using 768 cells for a command that just prints some text to chat. Use ONE string at about 128 cells and leave it at that. Reformat that string instead of declaring three unnecessarily huge strings.

  • Use of strtok
    Your suspection reason can be any number of words large. strtok only takes one word. strtok(cmdtext, idx, '`') should work.

  • Based it off of GUPS
    I could tell as soon as I saw strtok and PlayerInfo that you're using GUPS, which is the most overused script I have ever seen, and I am glad aXXo and I had moved Argo to Squirrel. Working with GUPS was a pain for large scripts.

  • Used Pawn
    scrap it and convert it to squirrel

  • The actual problem
    format(szMsg,sizeof(szMsg),"Officer %s suspected %s Reason:%s",gPlayers[playerid],gPlayers[plr],cmdtext[6]);

    Why are you using cmdtext[6]? Didn't you already define reason?

--------------  END HARSH CRITIQUE  --------------
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

<krystianoo> stormeus do good job
<krystianoo> with recent update
<krystianoo> if not agree; jeb yourself in head
<Avenger> yesterday you said death to stormeus
<karan> double standard krystianoo
<karan> he called him fake prophet too
<krystianoo> sure fake prophet
<krystianoo> but with recent updates real

morphine

  • Crazy Man
  • *****
  • Posts: 1909
  • Country: lt
    • View Profile
Re: [PAWNO]cmd format message problems
« Reply #2 on: October 26, 2011, 09:29:57 pm »
-------------------------------- Begin Rant --------------------------------

scrap it and convert it to squirrel" but JA ( personal reasons)
-------------------------------- End Rant --------------------------------
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor