Is this possible? - 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: Is this possible? (
/showthread.php?tid=206376)
Is this possible? -
SkizzoTrick - 03.01.2011
Hello everyone,im asking for some help.Is this possible?
I made a unique and AWSOME vehicle system but im confused.
pawn Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
new newcar = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(CarInfo[newcar][cOwner] == pname )
{
This should check if the vehicle belongs to that player.
I already tried this too
pawn Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
new newcar = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(newcar == PlayerInfo[playerid][pPcarkey] )
{
But it is not working,idk why.
Re: Is this possible? -
Kwarde - 03.01.2011
Quote:
if(CarInfo[newcar][cOwner] == pname )
{
|
Man use
strcmp xD - Did you get errors? I think so. (if not, I'm confused too)
Re: Is this possible? -
SkizzoTrick - 03.01.2011
Wow,i wanted to write the errors but i forgot

)
Im sorry,my bad
Код:
error 033: array must be indexed (variable "pname")
Re: Is this possible? -
Kwarde - 03.01.2011
Try a 'global' string, if you understand what I mean.
And did you had this?:
pawn Код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
if( !strcmp(CarInfo[newcar][cOwner], pName, false) ){ //Why the 'false'? Well, now it's case sensitive
//do something
}
else{
//Not owner
}
maybe something like that :')
Re: Is this possible? -
SkizzoTrick - 03.01.2011
Quote:
Originally Posted by Kwarde
Try a 'global' string, if you understand what I mean.
And did you had this?:
pawn Код:
new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, MAX_PLAYER_NAME); if( !strcmp(CarInfo[newcar][cOwner], pName, false) ){ //Why the 'false'? Well, now it's case sensitive //do something } else{ //Not owner }
maybe something like that :')
|
Yea,im gonna use this xD
Strfind would work?
Re: Is this possible? -
Kwarde - 03.01.2011
My script worked? If yes: Jippie!
And strfind would work too, but it's NOT recommended! Example:
I have the name Kwarde. I can use the vehicle now! (or whatever you wanted to make).
But now there comes an 'KwardeSux'. He can use it too, because the server found 'Kwarde' in his/her name! (I am an him :'))
Re: Is this possible? -
SkizzoTrick - 03.01.2011
OHh,understand,btw
It worked,thanks alot xD
Re: Is this possible? -
Kwarde - 03.01.2011
No problem.