ZCMD 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)
+--- Thread: ZCMD helP! (
/showthread.php?tid=323249)
ZCMD helP! -
Sal - 05.03.2012
whenever i compile this i get these errors
C:\Users\Jeremy.Jeremy-HP\Desktop\Games\Server\gamemodes\script1.pwn(441) : error 029: invalid expression, assumed zero
C:\Users\Jeremy.Jeremy-HP\Desktop\Games\Server\gamemodes\script1.pwn(441) : error 017: undefined symbol "cmd_setname"
C:\Users\Jeremy.Jeremy-HP\Desktop\Games\Server\gamemodes\script1.pwn(441) : error 029: invalid expression, assumed zero
C:\Users\Jeremy.Jeremy-HP\Desktop\Games\Server\gamemodes\script1.pwn(441) : fatal error 107: too many error messages on one line
pawn Код:
CMD:setname(playerid, params[]);
{
new pName[MAX_PLAYER_NAME]
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
if(PlayerInfo[playerid][Admin] >= 3)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF0000AA, "USAGE: /setname [ID] [Name]");
return 1;
}
else
{
if(sscanf(params, "ui", giveplayerid, pName))
{
SetPlayerName(giveplayerid, pName);
return 1;
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You are not an Admin!");
return 1;
}
return 1;
}
Re: ZCMD helP! -
Sal - 05.03.2012
Help me, I was pushed to use ZCMD and is really putting me off using it again and i was using strcmp earlier.
Re: ZCMD helP! -
rangerxxll - 05.03.2012
pawn Код:
CMD:setname(playerid, params[]);
{
new pName[MAX_PLAYER_NAME]
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
if(PlayerInfo[playerid][Admin] >= 3)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF0000AA, "USAGE: /setname [ID] [Name]");
return 1;
}
else
{
if(sscanf(params, "ui", giveplayerid, pName))
{
SetPlayerName(giveplayerid, pName);
return 1;
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You are not an Admin!");
return 1;
}
return 1;
}
Maybe the bracket was messing it up.
Re: ZCMD helP! -
Jack_Wilson - 05.03.2012
pawn Код:
CMD:setname(playerid, params[])
{
new pName[MAX_PLAYER_NAME]
tmp = strtok(cmdtext, idx);
giveplayerid = ReturnUser(tmp);
if(PlayerInfo[playerid][Admin] >= 3)
{
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFF0000AA, "USAGE: /setname [ID] [Name]");
return 1;
}
else
{
if(sscanf(params, "ui", giveplayerid, pName))
{
SetPlayerName(giveplayerid, pName);
return 1;
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You are not an Admin!");
return 1;
}
return 1;
}
Should work.
Re: ZCMD helP! -
fordawinzz - 05.03.2012
pawn Код:
CMD:setname(playerid, params[]) {
new
szUser,
szNewName[MAX_PLAYER_NAME]
;
if(PlayerInfo[playerid][Admin] >= 3) {
if(!sscanf(params, "us[24]", szUser, szNewName)) {
if(!IsPlayerConnected(szUser)) return SendClientMessage(playerid, 0xFF0000AA, "You are not an Admin!");
return SetPlayerName(szUser, pName);
}
else return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /setname [playerid/partofname] [newname]");
}
else return SendClientMessage(playerid, 0xFF0000AA, "You are not an Admin!");
}
^Jack Wilson, you should read the SSCANF topic before fixing errors like this