1
Scripting SA-MP [Pawn center] / Re : [Urgent]Commande pour mettre un rang
« le: 19 Avril 2012, 13:39:21 »
playerid s'est celui qui tape la commande donc ce n'est pas playerid
Cette section vous permet de consulter les contributions (messages, sujets et fichiers joints) d'un utilisateur. Vous ne pourrez voir que les contributions des zones auxquelles vous avez accès.
stock sscanf(string[], format[], {Float,_}:...)
{
new
formatPos = 0,
stringPos = 0,
paramPos = 2,
paramCount = numargs();
while (paramPos < paramCount && string[stringPos])
{
switch (format[formatPos++])
{
case '\0':
{
return 0;
}
case 'i', 'd':
{
new
neg = 1,
num = 0,
ch = string[stringPos];
if (ch == '-')
{
neg = -1;
ch = string[++stringPos];
}
do
{
stringPos++;
if (ch >= '0' && ch <= '9')
{
num = (num * 10) + (ch - '0');
}
else
{
return 1;
}
}
while ((ch = string[stringPos]) && ch != ' ');
setarg(paramPos, 0, num * neg);
}
case 'h', 'x':
{
new
ch,
num = 0;
while ((ch = string[stringPos++]))
{
switch (ch)
{
case 'x', 'X':
{
num = 0;
continue;
}
case '0' .. '9':
{
num = (num << 4) | (ch - '0');
}
case 'a' .. 'f':
{
num = (num << 4) | (ch - ('a' - 10));
}
case 'A' .. 'F':
{
num = (num << 4) | (ch - ('A' - 10));
}
case ' ':
{
break;
}
default:
{
return 1;
}
}
}
setarg(paramPos, 0, num);
}
case 'c':
{
setarg(paramPos, 0, string[stringPos++]);
}
case 'f':
{
new tmp[25];
strmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2);
setarg(paramPos, 0, _:floatstr(tmp));
}
case 's', 'z':
{
new
i = 0,
ch;
if (format[formatPos])
{
while ((ch = string[stringPos++]) && ch != ' ')
{
setarg(paramPos, i++, ch);
}
if (!i) return 1;
}
else
{
while ((ch = string[stringPos++]))
{
setarg(paramPos, i++, ch);
}
}
stringPos--;
setarg(paramPos, i, '\0');
}
default:
{
continue;
}
}
while (string[stringPos] && string[stringPos] != ' ')
{
stringPos++;
}
while (string[stringPos] == ' ')
{
stringPos++;
}
paramPos++;
}
while (format[formatPos] == 'z') formatPos++;
return format[formatPos];
}
(ligne 1546) - public PayTime()
{
for( new i = 0; i < MAX_PLAYERS; i ++ )
{
new hour;
GetPlayerTime(i, hour);
if((hour == 0) || (hour == 1) || (hour == 2) || (hour == 3) || (hour == 4) || (hour == 5) || (hour == 6) || (hour == 7) || (hour == 8) || (hour == 9) || (hour == 10) || (hour == 11) || (hour == 12) || (hour == 13) || (hour == 14) || (hour == 15) || (hour == 16) || (hour == 17) || (hour == 18) || (hour == 19) || (hour == 20) || (hour == 21) || (hour == 22) || (hour == 23))
{
SetPlayerScore(i,GetPlayerScore(i)+1);
GivePlayerMoney(i, 2000);
SendClientMessage(i, GOOD, " ____________________________________");
SendClientMessage(i, GOOD, "_______________{FFFFF}PAYTIME{00B9FF}____________________");
SendClientMessage(i, GOOD, " ");
SendClientMessage(i, GOOD, " ___ Il est maintenant %d heure ___", hour);
SendClientMessage(i, GOOD, " ");
SendClientMessage(i, GOOD, "Solde:{FFFFFF} 2000$");
new String[256];
format(String, sizeof(String), "Vous avez maintenant{FFFFFF} %d heures jouées.", GetPlayerScore(i));
SendClientMessage(i, GOOD, String);
if(Levels[i] >= 1)
{
SendClientMessage(i, DEVOIR, "Bonus Admin:{FFFFFF} 2500$");
GivePlayerMoney(i, 2500);
}
SendClientMessage(i, GOOD, " ____________________________________");
}
}
}
return 1;
}
C:\Users\macdo\Desktop\serveur\gamemodes\test.pwn(1551) : warning 202: number of arguments does not match definition
C:\Users\macdo\Desktop\serveur\gamemodes\test.pwn(1560) : warning 202: number of arguments does not match definition
C:\Users\macdo\Desktop\serveur\gamemodes\test.pwn(1578) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
public PayTime()
{
for( new i = 0; i < MAX_PLAYERS; i ++ )
{
new hour
GetPlayerTime(i, hour);
if((hour == 0) || (hour == 1))
{
SetPlayerScore(i,GetPlayerScore(i)+1);
GivePlayerMoney(i, 2000);
SendClientMessage(i, GOOD, " ____________________________________");
SendClientMessage(i, GOOD, "_______________{FFFFF}PAYTIME{00B9FF}____________________");
SendClientMessage(i, GOOD, " ");
SendClientMessage(i, GOOD, " ___ Il est maintenant %d heure ___", hour);
SendClientMessage(i, GOOD, " ");
SendClientMessage(i, GOOD, "Solde:{FFFFFF} 2000$");
SendClientMessage(i, GOOD, "Vous avez maintenant{FFFFFF} %d heures jouées.", GetPlayerScore(i));
if(Levels[i] >= 1)
{
SendClientMessage(i, DEVOIR, "Bonus Admin:{FFFFFF} 2500$");
GivePlayerMoney(i, 2500);
}
SendClientMessage(i, GOOD, " ____________________________________");
}
}
return 1;
}
C:\Users\macdo\Desktop\serveur\gamemodes\test.pwn(1551) : error 001: expected token: ";", but found "-identifier-"
C:\Users\macdo\Desktop\serveur\gamemodes\test.pwn(1551) : warning 202: number of arguments does not match definition
C:\Users\macdo\Desktop\serveur\gamemodes\test.pwn(1560) : warning 202: number of arguments does not match definition
C:\Users\macdo\Desktop\serveur\gamemodes\test.pwn(1563) : warning 202: number of arguments does not match definition
C:\Users\macdo\Desktop\serveur\gamemodes\test.pwn(1574) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.