Problem(error/warning): Komanda ne daje igracu score to je ne postavlja na zadani broj, niÅ¡ta se ne dogaÄ'a. @Ino42O
Dio skripte:
CMD:setscore(playerid, params[])
{
new string[128], pName[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME], pID, score;
if (PInfo[playerid][Admin] < 5) return SCM(playerid, -1"Nemozes to.");
if(sscanf(params, "ud", pID, score)) return SCM(playerid, -1,"[USAGE]: {FFFFFF}/setscore <playerid> <score>");
if(pID == INVALID_PLAYER_ID) return SCM(playerid, RED, "Igrac nije povezan");
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(pID, pName, sizeof(pName));
format(string, sizeof(string), "[GIVE]: {FFFFFF}%s ti je postavi score na %d name, score);
SCM(pID, COLOR_ADMIN, string);
format(string, sizeof(string), "[GIVE]: {FFFFFF}Postavio si %d score za %s", score, pName);
SCM(playerid, COLOR_ADMIN, string);
SetPlayerScore(pID, score);
return 1;
}
I ovdje ne daje igracu skor.
GivePlayerScore(captureZone[zoneid][E_CAPTURE_ZONE_ATTACKER], GetPlayerScore(captureZone[zoneid][E_CAPTURE_ZONE_ATTACKER]) + 2);
Kasnije sam dodao ovaj štok, ali nezz ima li potrebe za time
stock GivePlayerScore(playerid, score)
{
SetPlayerScore(playerid, GetPlayerScore(playerid)+score);
return 1;
}
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log):
Slika/video ingame problema(obavezno ako je ingame problem):
uradi debug
Pokušaj ovo.
[pawn]
CMD:setscore(playerid, params[])
{
new targetid, amount, string[100];
if (PInfo[playerid][Admin] < 5)
return SCM(playerid, -1, "Nemas dopustenje.");
if (sscanf(params, "ud", targetid, amount))
return SCM(playerid, -1, "/setscore ID Name");
if (targetid == INVALID_PLAYER_ID)
return SCM(playerid, -1, "ID igraca je nepostojeci.");
format(string,sizeof(string),"Postavili ste %s's score na %d.", PInfo[targetid[pName], amount);
SCM(targetid, -1, string);
format(string,sizeof(string),"%s vam je postavio score na %d.", PInfo[playerid][pName], amount);
SCM(playerid, -1, string);
SetPlayerScore(playerid, amount);
return 1;
}
[/pawn]
Nadji kako ti je definisan Score broj i kucas posle cmd SetPlayerScore(PlayerInfo[playerid][pScore] == %d,GetScore(ili definicija scora)
Eto,mozda bi trebalo da radi
Citat: Bolex_ poslato Mart 21, 2018, 15:32:18 POSLE PODNE
Pokušaj ovo.
[pawn]
CMD:setscore(playerid, params[])
{
new targetid, amount, string[100];
if (PInfo[playerid][Admin] < 5)
return SCM(playerid, -1, "Nemas dopustenje.");
if (sscanf(params, "ud", targetid, amount))
return SCM(playerid, -1, "/setscore ID Name");
if (targetid == INVALID_PLAYER_ID)
return SCM(playerid, -1, "ID igraca je nepostojeci.");
format(string,sizeof(string),"Postavili ste %s's score na %d.", PInfo[targetid[pName], amount);
SCM(targetid, -1, string);
format(string,sizeof(string),"%s vam je postavio score na %d.", PInfo[playerid][pName], amount);
SCM(playerid, -1, string);
SetPlayerScore(playerid, amount);
return 1;
}
[/pawn]
Hvala tbr.
Radi sada kako treba. <3
Citat: Bolex_ poslato Mart 21, 2018, 15:32:18 POSLE PODNE
Pokušaj ovo.
[pawn]
CMD:setscore(playerid, params[])
{
new targetid, amount, string[100];
if (PInfo[playerid][Admin] < 5)
return SCM(playerid, -1, "Nemas dopustenje.");
if (sscanf(params, "ud", targetid, amount))
return SCM(playerid, -1, "/setscore ID Name");
if (targetid == INVALID_PLAYER_ID)
return SCM(playerid, -1, "ID igraca je nepostojeci.");
format(string,sizeof(string),"Postavili ste %s's score na %d.", PInfo[targetid[pName], amount);
SCM(targetid, -1, string);
format(string,sizeof(string),"%s vam je postavio score na %d.", PInfo[playerid][pName], amount);
SCM(playerid, -1, string);
SetPlayerScore(playerid, amount);
return 1;
}
[/pawn]
Imas tu mali milion gresaka!
SetPlayerScore(playerid, amount);
u
SetPlayerScore(targetid, amount);
?
Komanda se koristi već godinama na server u mome signature, znao bih da ima problema ;)
Citat: Ino42O poslato Mart 21, 2018, 17:41:20 POSLE PODNE
SetPlayerScore(playerid, amount);
u
SetPlayerScore(targetid, amount);
?
Da ovo mora biti targetid inace ce setati igracu koji kuca komandu a ne zeljenom IDu.
Testao sam komandu sa prijateljem ovo što je tbr bolex dao i radi mi okej.
Moze lock tu. :)
cudna mi je ta komanda od bolexa lmao, al hj