Is this possible?
#1

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.
Reply
#2

Quote:

if(CarInfo[newcar][cOwner] == pname )
{

Man use strcmp xD - Did you get errors? I think so. (if not, I'm confused too)
Reply
#3

Wow,i wanted to write the errors but i forgot )
Im sorry,my bad

Код:
 error 033: array must be indexed (variable "pname")
Reply
#4

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 :')
Reply
#5

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?
Reply
#6

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 :'))
Reply
#7

OHh,understand,btw
It worked,thanks alot xD
Reply
#8

No problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)