21.06.2014, 17:19
Hello Guys,So The 1st Problem Is: I Made A Timer To All Players Under Ongamemodeinit Callback:
And It's Public Function:
When The Timer Ends,It Supposes To Send The Str Message To The Player Who Has The Highest Variable (KillerScore[MAX_PLAYERS]) And You Will See What Is That Variable Used On:
And Actually KillerScore Suppose To Be Increased +1 Each Time When The Killer Is Killing The Player,It's Putted Under OnPlayerDeath Callback:
Well The Problem In It Is,That It Sends The Message To All Players.
2nd Problem Is:
That In /v Command,It Supposes To Create The Vehicle And Destroy The Old One,But It Only Creates The Vehicle At These Codes:
Please Help If You Helped Me In Fixing Both 2 Problems You Will Have +REP.
pawn Код:
SetTimer("KillingScore", 1440000, true);
pawn Код:
forward KillingScore();
public KillingScore()
{
new highestmoney = GetHighestKiller(); // Get the highest holder of money.
new pnamez[MAX_PLAYER_NAME]; // Declare the variable which will hold the player name in array.
new str[64]; // Declare the variable which will hold the message in array.
if(highestmoney != INVALID_PLAYER_ID) // Check if he is a real player or -1.
{
for( new i = 0; i < MAX_PLAYERS; i ++ )
{
GetPlayerName(highestmoney, pnamez, sizeof(pnamez)); // Get the player's name.
format(str, sizeof(str), "Congratulations!, You Are The {FF0000}Killer {FFEE00}Of The Day!"); // Format the string with message.
SendClientMessage(i, 0xFFEE00FF, str); // Show the message.
}
}
}
pawn Код:
stock GetHighestKiller()
{
new
money,
player = -1
;
for (new i = 0, mx = GetMaxPlayers(); i != mx; ++i)
{
if (IsPlayerConnected(i))
{
if (KillerScore[i] > money)
{
player = i;
money = KillerScore[i];
}
}
}
return player;
}
pawn Код:
KillerScore[killerid] ++;
2nd Problem Is:
That In /v Command,It Supposes To Create The Vehicle And Destroy The Old One,But It Only Creates The Vehicle At These Codes:
pawn Код:
COMMAND:v(playerid, params[])
{
new vehname[32],color1,color2, getveh[MAX_PLAYERS], Message[128], pName26[MAX_PLAYER_NAME];
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, 0xFF0000AA, "You Are Not A Moderator Or Higher Rank!");
if(sscanf(params,"s[32]dd",vehname, color1, color2)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /v [vehicle [Name / ID]] [color1] [color2]");
new vehicleID = GetVehicleModelIDFromName(vehname);
if(vehicleID == (-1)) vehicleID = strval(vehname);
if(!(400 <= vehicleID <= 611)) return SendClientMessage(playerid, 0xFF0000AA, "Invalid vehicle ID/name");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
DestroyVehicle(getveh[playerid]);
getveh[playerid] = CreateVehicle(vehicleID, x, y, z, 90, color1, color2, 60000);
format(Message,sizeof(Message),"Successfully Spawned A Vehicle With Name/ID: {FFEE00}%s{FF00F7}.",vehname);
SendClientMessage(playerid, 0xFF00F7FF, Message);
PutPlayerInVehicle(playerid, getveh[playerid], 0);
AdminVehicle[getveh[playerid]] = 1;
if(PlayerInfo[playerid][pAdmin] > 0)
{
switch(PlayerInfo[playerid][pAdmin])
{
case 1: AdmRank = "Trial Moderator";
case 2: AdmRank = "Moderator";
case 3: AdmRank = "Master Moderator";
case 4: AdmRank = "Trial Administrator";
case 5: AdmRank = "Administrator";
case 6: AdmRank = "Master Administrator";
case 7: AdmRank = "Head Administrator";
case 8: AdmRank = "Trusted Administrator";
case 9: AdmRank = "Co-Owner";
case 10: AdmRank = "Owner";
}
}
foreach(Player, i)
{
if(PlayerInfo[i][pAdmin] > 0)
{
GetPlayerName(playerid, pName26, MAX_PLAYER_NAME);
format(Message, sizeof(Message), "[ADM] The {FF0000}%s {FF5900}%s (%d) Has Spawned A Vehicle.",AdmRank, pName26, playerid), SendClientMessage(i, 0xFF5900FF, Message);
print(Message);
}
}
return 1;
}