error 072: "sizeof" operator is invalid on "function" symbols
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", PlayerName, id, time, reason);
CMD:jail(playerid,params[]) { if(pInfo[playerid][pAdminLevel] >= 1) { new id,time,reason[100],szString[150]; if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, -1, "*"COL_WHITE" /jail [playerid] [time] [reason]"); if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1,"*"COL_RED" Player is not connected."); if(Jailed[id] == 1) return SendClientMessage(playerid, -1, "*"COL_RED" Player is already jailed."); format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", PlayerName, id, time, reason); SendClientMessageToAll(-1, szString); GetPlayerName(id, PlayerName, sizeof(PlayerName)); GetPlayerName(playerid, GetPlayerName, sizeof(GetPlayerName)); SetPlayerInterior(id, 3); SetPlayerVirtualWorld(id, 10); SetPlayerFacingAngle(id, 360.0); SetPlayerPos(id, 197.5662, 175.4800, 1004.0); SetPlayerHealth(id, 9999999999.0); ResetPlayerWeapons(id); JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id); } else{ return 0; } return 1; }
GetPlayerName(id, PlayerName, sizeof(PlayerName));
if(sscanf(params,"dds",id,time,reason))
if(sscanf(params,"dds[100]",id,time,reason))
CMD:jail(playerid,params[]) { if(pInfo[playerid][pAdminLevel] >= 1) { new id, time, reason[100], szString[150], PlayerName[MAX_PLAYER_NAME+1] ; if (sscanf(params, "iis[100]", id, time, reason)) return SendClientMessage(playerid, -1, "*"COL_WHITE" /jail [playerid] [time] [reason]"); if (!IsPlayerConnected(id)) return SendClientMessage(playerid, -1,"*"COL_RED" Player is not connected."); if (Jailed[id] == 1) return SendClientMessage(playerid, -1, "*"COL_RED" Player is already jailed."); GetPlayerName(id, PlayerName, sizeof(PlayerName)); format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", PlayerName, id, time, reason); SendClientMessageToAll(-1, szString); SetPlayerInterior(id, 3); SetPlayerVirtualWorld(id, 10); SetPlayerFacingAngle(id, 360.0); SetPlayerPos(id, 197.5662, 175.4800, 1004.0); SetPlayerHealth(id, 9999999999.0); ResetPlayerWeapons(id); JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id); } else return 0; return 1; }
CMD:jail(playerid,params[])
{
if(pInfo[playerid][pAdminLevel] >= 1)
{
new id,time,reason[100],szString[150];
if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, -1, "*"COL_WHITE" /jail [playerid] [time] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1,"*"COL_RED" Player is not connected.");
if(Jailed[id] == 1) return SendClientMessage(playerid, -1, "*"COL_RED" Player is already jailed.");
{
GetPlayerName(id, PlayerName, sizeof(PlayerName));
GetPlayerName(playerid, GetPlayerName, sizeof(GetPlayerName));
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", PlayerName, id, time, reason);
SendClientMessageToAll(-1, szString);
}
{
SetPlayerInterior(id, 3);
SetPlayerVirtualWorld(id, 10);
SetPlayerFacingAngle(id, 360.0);
SetPlayerPos(id, 197.5662, 175.4800, 1004.0);
SetPlayerHealth(id, 9999999999.0);
ResetPlayerWeapons(id);
JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);
}
else{
return 0;
}
return 1;
}
CMD:jail(playerid,params[])
{
if(pInfo[playerid][pAdminLevel] >= 1)
{
new reason[100];
if(sscanf(params, "uis[100]", params[0], params[1], reason))
return SendClientMessage(playerid, -1, "*"COL_WHITE" /jail [playerid] [time] [reason]");
if(!IsPlayerConnected(params[0]) && params[0] == INVALID_PLAYER_ID)
return SendClientMessage(playerid, -1,"*"COL_RED" Player is not connected.");
if(Jailed[params[0]] == 1)
return SendClientMessage(playerid, -1, "*"COL_RED" Player is already jailed.");
new name1[24], name2[24];
GetPlayerName(params[0], name1, sizeof(name1));
GetPlayerName(playerid, name2, sizeof(name2));
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", name1, params[0], params[1], reason);
SendClientMessageToAll(-1, szString);
SetPlayerInterior(params[0], 3);
SetPlayerVirtualWorld(params[0], 10);
SetPlayerFacingAngle(params[0], 360.0);
SetPlayerPos(params[0], 197.5662, 175.4800, 1004.0);
SetPlayerHealth(params[0], 9999999999.0);
ResetPlayerWeapons(params[0]);
JailTimer[params[0]] = SetTimerEx("Unjail", params[1]*60000, false, "i", params[0]);
}
return true;
}
this is better.
Use the slots to sscanf, so it will be faster and do not need to create so many variables. PHP код:
|
CMD:unjail(playerid,params[]) { new id; if(pInfo[playerid][pAdminLevel] >= 1) { if(sscanf(params,"u",id)) return SendClientMessage(playerid, -1, "*"COL_WHITE" /unjail [playerid]"); if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "*"COL_RED" Player is not connected."); if(Jailed[id] == 0) return SendClientMessage(playerid, -1, "*"COL_RED" Player is not jailed."); Jailed[id] = 0; SetPlayerInterior(id, 0); SetPlayerVirtualWorld(id, 0); SpawnPlayer(id); SetPlayerHealth(id, 100); KillTimer(JailTimer[id]); } else { SendClientMessage(playerid, -1, "*"COL_RED" You do not have the right admin permissions for this command!"); } return 1; }
CMD:unjail(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] >= 1)
{
if(sscanf(params, "u", params[0]))
return SendClientMessage(playerid, -1, "*"COL_WHITE" /unjail [playerid]");
if(!IsPlayerConnected(params[0]) && params[0] == INVALID_PLAYER_ID)
return SendClientMessage(playerid, -1, "*"COL_RED" Player is not connected.");
if(Jailed[params[0]] == 0)
return SendClientMessage(playerid, -1, "*"COL_RED" Player is not jailed.");
SetPlayerInterior(params[0], 0);
SetPlayerVirtualWorld(params[0], 0);
SpawnPlayer(params[0]);
SetPlayerHealth(params[0], 100);
KillTimer(JailTimer[params[0]]);
Jailed[params[0]] = 0;
}
return true;
}
CMD:jail(playerid,params[])
{
if(pInfo[playerid][pAdminLevel] >= 1)
{
new reason[100];
if(sscanf(params, "uis[100]", params[0], params[1], reason))
return SendClientMessage(playerid, -1, "*"COL_WHITE" /jail [playerid] [time] [reason]");
if(!IsPlayerConnected(params[0]) && params[0] == INVALID_PLAYER_ID)
return SendClientMessage(playerid, -1,"*"COL_RED" Player is not connected.");
if(Jailed[params[0]] == 1)
return SendClientMessage(playerid, -1, "*"COL_RED" Player is already jailed.");
new name1[24], name2[24];
GetPlayerName(params[0], name1, sizeof(name1));
GetPlayerName(playerid, name2, sizeof(name2));
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", name1, params[0], params[1], reason);
SendClientMessageToAll(-1, szString);
Jailed[params[0]] = 1;
ResetPlayerWeapons(params[0]);
SetPlayerInterior(params[0], 3);
SetPlayerVirtualWorld(params[0], 10);
SetPlayerFacingAngle(params[0], 360.0);
SetPlayerPos(params[0], 197.5662, 175.4800, 1004.0);
SetPlayerHealth(params[0], 9999999999.00);
JailTimer[params[0]] = SetTimerEx("Unjail", params[1]*60*1000, false, "i", params[0]);
}
return true;
}
CMD:unjail(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] >= 1)
{
if(sscanf(params, "u", params[0]))
return SendClientMessage(playerid, -1, "*"COL_WHITE" /unjail [playerid]");
if(!IsPlayerConnected(params[0]) && params[0] == INVALID_PLAYER_ID)
return SendClientMessage(playerid, -1, "*"COL_RED" Player is not connected.");
if(Jailed[params[0]] == 0)
return SendClientMessage(playerid, -1, "*"COL_RED" Player is not jailed.");
SetPlayerInterior(params[0], 0);
SetPlayerVirtualWorld(params[0], 0);
SpawnPlayer(params[0]);
SetPlayerHealth(params[0], 100);
KillTimer(JailTimer[params[0]]);
Jailed[params[0]] = 0;
}
return true;
}
forward Unjail(playerid);
public Unjail(playerid)
{
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
SpawnPlayer(playerid);
SetPlayerHealth(playerid, 100);
Jailed[playerid] = 0;
return true;
}