public OnFilterScriptInit() { foreach(new i: Player) { SetPVarInt(i, "laser", 0); SetPVarInt(i, "color", 18643); } return 1; } public OnFilterScriptExit() { foreach(new i: Player) { SetPVarInt(i, "laser", 0); RemovePlayerAttachedObject(i, 0); } return 1; }
foreach(new i: Player)
for(new i = 0; i < MAX_PLAYERS; i++)
pawn Код:
pawn Код:
|
undefined symbol "foreach" error 029: invalid expression, assumed zero error 017: undefined symbol "Player" fatal error 107: too many error messages on one lin
#include <a_samp>
// first include is a_samp always, then the rest..
#include <foreach>
// Somewhere below:
foreach(new i: Player)
Is it like that?
pawn Код:
|
dcmd_laser(playerid,params[]) { SetPVarInt(playerid, "laser", 1); SetPVarInt(playerid, "color", GetPVarInt(playerid, "color")); return 1; } dcmd_laseroff(playerid,params[]) { SetPVarInt(playerid, "laser", 0); RemovePlayerAttachedObject(playerid, 0); return 1; }
dcmd_laser(playerid,params[])
{
#pragma unused params
SetPVarInt(playerid, "laser", 1);
SetPVarInt(playerid, "color", GetPVarInt(playerid, "color"));
return 1;
}
dcmd_laseroff(playerid,params[])
{
#pragma unused params
SetPVarInt(playerid, "laser", 0);
RemovePlayerAttachedObject(playerid, 0);
return 1;
}
#pragma unused params
pawn Код:
1 nanosecond = 1.0 Ч 10(^-9) seconds and the difference between our posts was 1 minute! |
You're using dcmd, practically old command processor. Use
pawn Код:
|
You shouldn't be using dcmd, consider switching to zcmd, also easier to use.
https://sampforum.blast.hk/showthread.php?tid=91354 |
Player Statistics TheDream (ID:98) General: - Total Time Logged in: - Ping: Scores: - Kills: - Ratio: - Money: Game: - Virtual World: - Interior: - Wanted Level: - Skin: - PM's: - Go's: - God:
dcmd_stats(playerid,params[]) { new str[512], pDeaths, player1, h, m, s; new status[2][10] = {"Disabled", "Enabled"}; if(!strlen(params)) player1 = playerid; else player1 = strval(params); if(!IsPlayerConnected(player1)) return SendClientMessage(playerid, white, "{FF0000}>> Player not Connected"); TotalGameTime(player1, h, m, s); if(AccInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = AccInfo[player1][Deaths]; format(str, sizeof(str), "{DAA520}%s (ID: %d){B0C4DE}\n\n", PlayerName2(player1), player1); format(str, sizeof(str), "%sSkinID: %d\n", str, GetPlayerSkin(player1)); format(str, sizeof(str), "%sScore: %d\n", str, GetPlayerScore(player1)); format(str, sizeof(str), "%sKills: %d\n", str, AccInfo[player1][Kills]); format(str, sizeof(str), "%sMoney: $%d\n", str, GetPlayerMoney(player1)); format(str, sizeof(str), "%sRatio: %.2f\n", str, Float:AccInfo[player1][Kills]/Float:pDeaths); format(str, sizeof(str), "%sInterior: %d\n", str, GetPlayerInterior(player1)); format(str, sizeof(str), "%sVirtual World: %d\n", str, GetPlayerVirtualWorld(player1)); format(str, sizeof(str), "%sWanted Level: %d\n\n", str, GetPlayerWantedLevel(player1)); format(str, sizeof(str), "%sPM: %s\n", str, status[GetPVarInt(player1, "PMEnabled")]); format(str, sizeof(str), "%sGod: %s\n", str, status[GetPVarInt(player1, "GodMode")]); format(str, sizeof(str), "%sGo's: %s\n\n", str, status[GetPVarInt(player1, "GotoEnabled")]); format(str, sizeof(str), "%sPing: %d\n", str, GetPlayerPing(player1)); format(str, sizeof(str), "%sTime Login: %d hours %d minutes %d seconds\n", str, h, m, s); ShowPlayerDialog(playerid, 8435, DIALOG_STYLE_MSGBOX, "Player Statistics", str, "Close", ""); return 1; } #endif
dcmd_stats(playerid,params[])
{
new pDeaths, player1, h, m, s, str[512], str1[128];
new status[2][10] = {"Disabled", "Enabled"};
if(!strlen(params)) player1 = playerid;
else player1 = strval(params);
if(!IsPlayerConnected(player1)) return SendClientMessage(playerid, white, "{FF0000}>> Player not Connected");
TotalGameTime(player1, h, m, s);
if(AccInfo[player1][Deaths] == 0) pDeaths = 1;
else pDeaths = AccInfo[player1][Deaths];
format(str, sizeof(str), "{DAA520}%s (ID: %d){B0C4DE}\n\n", PlayerName2(player1), player1);
str1 = "General:\n";
strcat(str,str1);
format(str, sizeof(str), "%sTime Login: %d hours %d minutes %d seconds\n", str, h, m, s);
format(str, sizeof(str), "%sPing: %d\n", str, GetPlayerPing(player1));
str1 = "Scores:\n";
strcat(str,str1);
format(str, sizeof(str), "%sScore: %d\n", str, GetPlayerScore(player1));
format(str, sizeof(str), "%sKills: %d\n", str, AccInfo[player1][Kills]);
format(str, sizeof(str), "%sMoney: $%d\n", str, GetPlayerMoney(player1));
format(str, sizeof(str), "%sRatio: %.2f\n", str, Float:AccInfo[player1][Kills]/Float:pDeaths);
str1 = "Game:\n";
strcat(str,str1);
format(str, sizeof(str), "%sSkinID: %d\n", str, GetPlayerSkin(player1));
format(str, sizeof(str), "%sInterior: %d\n", str, GetPlayerInterior(player1));
format(str, sizeof(str), "%sVirtual World: %d\n", str, GetPlayerVirtualWorld(player1));
format(str, sizeof(str), "%sWanted Level: %d\n\n", str, GetPlayerWantedLevel(player1));
format(str, sizeof(str), "%sPM: %s\n", str, status[GetPVarInt(player1, "PMEnabled")]);
format(str, sizeof(str), "%sGod: %s\n", str, status[GetPVarInt(player1, "GodMode")]);
format(str, sizeof(str), "%sGo's: %s\n\n", str, status[GetPVarInt(player1, "GotoEnabled")]);
strcat(str,str1);
ShowPlayerDialog(playerid, 8435, DIALOG_STYLE_MSGBOX, "Player Statistics", str, "Close", "");
return 1;
}