SA-MP Forums Archive
Need a little bit help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need a little bit help (/showthread.php?tid=148905)



Need a little bit help - gurufan - 19.05.2010

Hi,


I'm making my own script but i have one problem i want to make such command "/job1 nick_name" to set job for player nick_name ,but i can't get working, when i write nick system make job for myself.

Thanks in advance

Код:
           if(!strcmp(cmdtext, "/job1", true, 8)) 
  {
    if(!cmdtext[8])return SendClientMessage(playerid, 0xFF0000FF, "NAUDOJIMAS : /job1 [PLAYER NAME]");

    	if(gTeam[playerid] == PREZIDENT)
				{
    
    giveplayername = strval(tmp);
        if (IsPlayerConnected(giveplayerid)) {
           GetPlayerName(giveplayername, giveplayer, sizeof(giveplayer));
					 SendClientMessage(giveplayername, COLOR_GREEN, "Now you are POLICE chief");
           SendClientMessage(giveplayername, COLOR_YELLOW, "CMD : /make1 [PLAYER NAME]");
	         gTeam[giveplayername] = DIRECTOR_cops;
	         SetPlayerSkin(giveplayername, 147);
           TogglePlayerControllable(giveplayername,1);
		       GivePlayerWeapon(giveplayername,23, 2);
           GivePlayerWeapon(giveplayername,27, 3);
     return 1;
                    }else{
    format(string, sizeof(string), "user: %d is not active.", giveplayername);
		SendClientMessage(playerid, COLOR_YELLOW, string);
}
    return 1;
  } else { SendClientMessage(playerid, COLOR_GREEN, "Only prezident can make you director."); }
  return 1;
  }



Re: Need a little bit help - gurufan - 19.05.2010

anybody knows ?


Re: Need a little bit help - sushihusi - 19.05.2010

Make it not with player name but with id. Its easyer and better.


Re: Need a little bit help - gurufan - 19.05.2010

but i need with player name and i don't know how to do that


Re: Need a little bit help - juice.j - 19.05.2010

It would be a hell lot easier and better if you switched to DCMD/ZCMD.


Re: Need a little bit help - cmg4life - 19.05.2010

Quote:
Originally Posted by juice.j
It would be a hell lot easier and better if you switched to DCMD/ZCMD.
JJ speaks from xperience hehe...

Also learn about sscanf, it helps, don't mess DCMD/ZCMD with strlen and shits.