hi
ich suche einen /pay command, also dass man spieler spielern geld geben können. und kann des dann iwie in Pay.log gespeichert werden??
danke im vorraus
Flo
hi
ich suche einen /pay command, also dass man spieler spielern geld geben können. und kann des dann iwie in Pay.log gespeichert werden??
danke im vorraus
Flo
like this?
//-----------------------------------------------[Pay]----------------------------------------------------------------------------------//
if(strcmp(cmd, "/pay", true) == 0) {
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [PlayerID] [Amount]");
return 1;
}
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [PlayerID] [Amount]");
return 1;
}
moneys = strval(tmp);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys) {
GivePlayerMoney(playerid, (0 - moneys));
GivePlayerMoney(giveplayerid, moneys);
format(string, sizeof(string), " *You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), " *You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
printf(" *%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
}
else {
SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
}
}
else {
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
return 0;
}
Alles anzeigen
MfG
D:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\Test2.pwn(1062) : error 017: undefined symbol "cmd"
D:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\Test2.pwn(1064) : error 017: undefined symbol "strtok"
D:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\Test2.pwn(1064) : error 033: array must be indexed (variable "tmp")
D:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\Test2.pwn(1070) : error 017: undefined symbol "giveplayerid"
D:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\Test2.pwn(1072) : error 017: undefined symbol "strtok"
D:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\Test2.pwn(1072) : error 033: array must be indexed (variable "tmp")
D:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\Test2.pwn(1077) : error 017: undefined symbol "moneys"
D:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\Test2.pwn(1081) : error 017: undefined symbol "giveplayerid"
D:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\Test2.pwn(1082) : error 017: undefined symbol "giveplayerid"
D:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\Test2.pwn(1082) : error 017: undefined symbol "giveplayer"
D:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\Test2.pwn(1082) : error 029: invalid expression, assumed zero
D:\PROGRA~1\ROCKST~1\GTASAN~1\SAMP02~1.WIN\GAMEMO~1\Test2.pwn(1082) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
12 Errors.
core er braucht die difinitonen
Man kann nicht einfach einen Befehl aus dem Godfather script in ein neues Script einfügen...
und a-day wenn du sagst das er das und das braucht poste es doch einfach, einfach sagen und nichts tun ist eigentlich garnichts.
machs mal soo..
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
new playermoney;
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new cmd[256];
new giveplayerid, moneys, idx;
cmd = strtok(cmdtext, idx);
//-----------------------------------------------[Pay]----------------------------------------------------------------------------------//
if(strcmp(cmd, "/pay", true) == 0) {
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [PlayerID] [Amount]");
return 1;
}
giveplayerid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [PlayerID] [Amount]");
return 1;
}
moneys = strval(tmp);
if (IsPlayerConnected(giveplayerid)) {
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys) {
GivePlayerMoney(playerid, (0 - moneys));
GivePlayerMoney(giveplayerid, moneys);
format(string, sizeof(string), " *You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), " *You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
printf(" *%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
}
else {
SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
}
}
else {
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}
return 0;
}
Alles anzeigen
muss des alles zum OnPlayercommandText?
jo, steht auch da
wenn du probleme hast .. IcQ 282825198
Da...
danke funzt jetzt
wie kann ich des jetzt in ner datei speichern? also dass jedes mal wenn einer /pay benutzt, dass des dann in zB in der datei Pay.log ist?