command from zcmd to strcmp - 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: command from zcmd to strcmp (
/showthread.php?tid=417978)
command from zcmd to strcmp -
toi - 23.02.2013
How can I convert this command STRCMP?
Код:
CMD:myskin( playerid, params[] )
{
if ( P_DATA[ playerid ][ P_Logged ] == 0 )
return SendError( playerid, "You must be logged in to change your skin! ~n~Type ~b~~h~/login.");
if ( sscanf( params, "i", params[ 0 ] ) )
return SendUsage( playerid, "/myskin <skin ID>");
if ( !IsValidSkin( params[ 0 ] ) )
return SendError( playerid, "Invalid skin inserted!");
P_DATA[ playerid ][ P_Skin ] = params[ 0 ];
SetPlayerSkin( playerid, params[ 0 ] );
new String[ 129 ];
format( String, sizeof String, "You have changed your skin to ~b~~h~%d~w~. It has been saved into your account, on next login this skin will be applied.", params[ 0 ] );
Info( playerid, String, 5000);
new iUID = BUD::GetNameUID( PlayerName2( playerid ) );
BUD::SetIntEntry(iUID, "Skin", params[ 0 ] );
return 1;
}
Re: command from zcmd to strcmp -
Djole1337 - 23.02.2013
Err, why would you convert ZCMD to STRCMP ?
Re: command from zcmd to strcmp -
Goldino - 23.02.2013
So, you converted from strcmp to zcmd. And, you decided to convert back because it's rubbish? o.O
Re : command from zcmd to strcmp -
yusei - 23.02.2013
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[30];
new idx;
cmd = strtokt(cmdtext, idx);
if(strcmp(cmdtext, "/myskin", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new tmp[30];
tmp = strtokt(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, -1, "Usage /myskin [Skinid]");
return 1;
}
new skinid;
skinid = strval(tmp);
SetPlayerSkin(playerid,skinid);
}
return 1;
}
return 0;
}
PHP код:
strtokt(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
Re: command from zcmd to strcmp -
Gamer_007 - 23.02.2013
Why are u converting to STRCMP.ZCMD is better than STRCMP