30.12.2013, 00:49
Hi. How to create command with param in strcmp and strtok like this:
and how to check nick up(1) id?
Код:
/check 1
/check 1
if(!strcmp(cmdtext, "/cdom", true)) { if(IsPlayerAdmin(playerid)) { new Gracz[64]; new PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid,PlayerName,sizeof(PlayerName)); format(Gracz,sizeof(Gracz), HOUSE ,PlayerName); dini_Create(Gracz); dini_IntSet(Gracz,"Kasa",0); } return 1; }
if(!strcmp(cmdtext, "/cdom", true, 5) && (cmdtext[5] == '\0' || cmdtext[5] == ' '))
{
if(IsPlayerAdmin(playerid))
{
new ID = strval(cmdtext[6]);
if(IsPlayerConnecyed(ID))
{
new Gracz[64],PlayerName[MAX_PLAYER_NAME + 1];
GetPlayerName(ID, PlayerName, MAX_PLAYER_NAME);
format(Gracz,sizeof(Gracz), HOUSE ,PlayerName);
dini_Create(Gracz);
dini_IntSet(Gracz,"Kasa",0);
}
}
return 1;
}
error 028: invalid subscript (not an array or too many subscripts): "playerid" warning 215: expression has no effect error 001: expected token: ";", but found "]" error 029: invalid expression, assumed zero fatal error 107: too many error messages on one line
public OnPlayerSpawn(playerid) { new ID = strval(playerid[6]); if(IsPlayerConnected(ID)) { new HOUSE[128], pname[MAX_PLAYER_NAME + 1]; new Float:x, Float:y, Float:z; GetPlayerName(ID, PlayerName, MAX_PLAYER_NAME); format(Gracz,sizeof(Gracz), HOUSE ,PlayerName); x = dini_Float(HOUSE, "posX"); y = dini_Float(HOUSE, "posY"); z = dini_Float(HOUSE, "posZ"); SetPlayerPos(playerid, x, y, z); } return 1; } //In Commands if(!strcmp(cmdtext, "/cdom", true, 5) && (cmdtext[5] == '\0' || cmdtext[5] == ' ')) { if(IsPlayerAdmin(playerid)) { new ID = strval(cmdtext[6]); if(IsPlayerConnected(ID)) { new Float:x, Float:y, Float:z; new Gracz[64],PlayerName[MAX_PLAYER_NAME + 1]; GetPlayerName(ID, PlayerName, MAX_PLAYER_NAME); format(Gracz,sizeof(Gracz), HOUSE ,PlayerName); if(!dini_Exists(HOUSE)) dini_Create(HOUSE); GetPlayerPos(playerid, x, y, z); dini_FloatSet(HOUSE, "posX", x); dini_FloatSet(HOUSE, "posY", y); dini_FloatSet(HOUSE, "posZ", z); } } return 1; }
public OnPlayerSpawn(playerid)
{
new ID = strval(playerid[6]);
if(IsPlayerConnected(ID))
{
new HOUSE[128], pname[MAX_PLAYER_NAME + 1];
new Float:x, Float:y, Float:z;
GetPlayerName(ID, PlayerName, MAX_PLAYER_NAME);
format(Gracz,sizeof(Gracz), HOUSE ,PlayerName);
x = dini_Float(HOUSE, "posX");
y = dini_Float(HOUSE, "posY");
z = dini_Float(HOUSE, "posZ");
SetPlayerPos(playerid, x, y, z);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
new Gracz[64], pname[MAX_PLAYER_NAME], Float:x, Float:y, Float:z;
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
format(Gracz,sizeof(Gracz), HOUSE ,PlayerName);
x = dini_Float(HOUSE, "posX");
y = dini_Float(HOUSE, "posY");
z = dini_Float(HOUSE, "posZ");
SetPlayerPos(playerid, x, y, z);
return 1;
}