/givelicense help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /givelicense help (
/showthread.php?tid=143342)
/givelicense help -
Dolph - 22.04.2010
pawn Код:
new license[MAX_PLAYERS];
pawn Код:
dini_IntSet(file,"license", license[playerid]);
(under on player disconnect)
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(license[playerid] == 0)
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOUR_RED,"You don't have a license");
return 1;
}
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if (newstate == PLAYER_STATE_DRIVER)
{
if(license[playerid] == 0)
{
RemovePlayerFromVehicle(playerid);
return 1;
}
else
{
return 1;
}
}
return 1;
}
pawn Код:
license[playerid] = dini_Int(file,"license");
(under login)
pawn Код:
dini_IntSet(file,"license", 0);
To the problem: So I am trying to make a RP server, and I will start by adding a /givelicense command. The problem is that
when I do the command is that:
1. "You don't have a license" still are there when you enter a vehicle
2. It works until you log out. It won't work if you log in.
So all in all, it works, but it wont save, and the error won't go away.
Thanks in advance
Re: /givelicense help -
Dolph - 22.04.2010
Forgot the command..
pawn Код:
dcmd_givelicense(playerid,params[])
{
if(admin[playerid] <= 3) return 0;
new pid;
if(sscanf(params,"i",pid)) return SendClientMessage(playerid, 0xF60000AA, "USAGE: /givelicense [playerid]");
else if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, 0xFF0000FF, "There is no player online with that id online");
else
{
new name[MAX_PLAYER_NAME],string[128];
GetPlayerName(pid,name,sizeof(name));
license[pid] = 1;
format(string,sizeof(string),"An admin gave you license");
SendClientMessage(pid,0xF60000AA,string);
return 1;
}
}