SA-MP Forums Archive
Make script run properly - 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: Make script run properly (/showthread.php?tid=158311)



Make script run properly - VoViNaToR - 09.07.2010

How to make it run properly

new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 )
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, Owner! You are right person, welcome);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, You are wrong person, GFO);


it for all players shows that they are owners of a vehicle


Re: Make script run properly - CAR - 09.07.2010

You mean Removing if he's not the owner?
pawn Код:
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 )
{
   SendClientMessage(playerid, COLOR_LIGHTBLUE, Owner! You are right person, welcome);
   return 1;
}
else
{
   SendClientMessage(playerid, COLOR_LIGHTBLUE, You are wrong person, GFO);
   RemovePlayerFromVehicle(playerid);
}



Re: Make script run properly - VoViNaToR - 09.07.2010

Код:
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 )
No he detect that all players have same name


Re: Make script run properly - Carlton - 09.07.2010

Quote:
Originally Posted by VoViNaToR
Посмотреть сообщение
Код:
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 )
No he detect that all players have same name
Most likely the problem is that VehicleInfo[veh][vOwner] is a blank string, which means it will automatically be true. You need to make sure VehicleInfo[veh][vOwner] is not empty, and filled with text.


Re: Make script run properly - VoViNaToR - 09.07.2010

No it isnt empty
Код:
Owner=Tony_MacTavish



Re: Make script run properly - Carlton - 09.07.2010

You just took it out of the file, print the value of VehicleInfo[veh][vOwner]


Re: Make script run properly - VoViNaToR - 09.07.2010

Ok i just made this to make sure that owners name is there
Код:
 format(string, sizeof(string), "--|Welcome back to your %s|-- Owners name is: %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
And it shows owners name corectly so i gues this
Код:
 if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 )
Isnt working


Re: Make script run properly - Carlton - 09.07.2010

Ok, I see the error.

pawn Код:
if(!strcmp(plname, VehicleInfo[veh][vOwner], true))
That should work.


Re: Make script run properly - Hiddos - 09.07.2010

It actually checks if it returns 0, what the other one also did :P


Re: Make script run properly - VoViNaToR - 09.07.2010

Ouuu daaam BIG Thanks it Works