25.11.2017, 19:03
I made this command and when i use it , i get a error in the server logs and also it doesnt set the player as vip
PHP код:
CMD:setvip(playerid, params[])
{
new months,str[128],ID;
if(IsPlayerAdmin(playerid) || pInfo[playerid][Admin] >= 7)
{
if(sscanf(params,"ui",ID,months)) return SendClientMessage(playerid,0xFFFFFFAA, "Usage: /setvip [id] [months 0-12]");
if(months > 12) return SendClientMessage(playerid,0xFF0000AA,"Error: Maximum months - 12");
if(months < 0) return SendClientMessage(playerid,0xFF0000AA,"Error: Invalid Month!");
if(!IsPlayerConnected(ID))return SendClientMessage(playerid,0xFF0000AA,"Error: Invalid player id!");
new string[128];
format(string,sizeof(string),"Error: That person already posses VIP Level 1.");
if(pInfo[ID][VIP] == 1) return SendClientMessage(playerid,0xFF0000AA,string);
{
if(months == 1)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (1 Month) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~1 Month VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package (1 Month) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*30;
SaveChar(ID);
}
if(months == 2)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (2 Months) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~2 Months VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package (2 Months) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*60;
}
if(months == 3)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (3 Months) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~3 Months VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package (3 Months) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*90;
}
if(months == 4)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (4 Months) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~4 Months VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package (4 Months) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*120;
}
if(months == 5)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (5 Months) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~5 Months VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package (5 Months) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*150;
}
if(months == 6)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (6 Months) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~6 Months VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package (6 Months) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*180;
}
if(months == 7)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (7 Months) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~7 Months VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package (7 Months) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*210;
}
if(months == 8)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (8 Months) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~8 Months VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package (8 Months) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*240;
}
if(months == 9)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (9 Months) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~9 Months VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package (9 Months) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*270;
}
if(months == 10)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (10 Months) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~10 Months VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package (10 Months) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*300;
}
if(months == 11)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (11 Months) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~11 Months VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package (11 Months) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*330;
}
if(months == 12)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package (1 Year) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~1 Year VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package (1 Year) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*360;
}
if(months == 0)
{
SendClientMessage(ID,0xFFFF00AA,"You have recieved VIP Package 1 (Life Time) Subscribtion.");
GameTextForPlayer(ID, "Enjoy ~g~Unlimited VIP!", 3000, 5);
SendClientMessage(ID,0xFFFFFFAA,"Type /vcmds for the list of VIP commands.");
format(str, sizeof(str),"You've given %s a VIP Package 1 (Life Time) subscription",GetName(ID));
SendClientMessage(playerid,0xFFFFFFAA,str);
pInfo[ID][VIP] = 1;
pInfo[ID][VIPTIME] = gettime()+60*60*24*1000;
}
}
}
else return ShowMessage(playerid, error, 1);
return 1;
}
PHP код:
[23:07:08] [debug] Run time error 6: "Invalid instruction"
[23:07:08] [debug] Unknown opcode 0x62b90c8 at address 0x00000038
[23:07:08] [debug] AMX backtrace:
[23:07:08] [debug] #0 00000038 in public cmd_setvip () at <unknown file>:0
[23:07:08] [debug] #1 native CallLocalFunction () from samp-server.exe
[23:07:08] [debug] #2 00000aa0 in public OnPlayerCommandText (playerid=0, cmdtext[]=@04615ef8 "/setvip 0 1") at C:\Users\Andre'\Desktop\Andre'\samp\pawno\include\zcmd.inc:106