Checking a string...
#1

hello

i dont really ask for help much but now i got nowhere to turn besides to the great scripters of sa-mp

anyways im making some pickups...i add them by creating a function then puting it in ongamemodeint or watever...

but now i ran into this small problem,when the player walks over the pickup i want the messege to say you are standing in pickup 1 or 2...

anyways heres an example


CreateExample (name[],Float:Hx,Float:Hy,Float:Hz)
{
CreatePickup(1273,23,Hx,Hy,Hz,0);
Create3DTextLabel(name,0xFF0000AA,Hx,Hy,Hz+20,20,0 );
}

public OnFilterScriptInit()
{
CreateExample("pickup 1",2029.6508,1343.2561,10.8203);
CreateExample("pickup 2",2029.4835,1340.2711,10.8203);
CreateExample("pickup 3",2029.9989,1345.3268,10.8203);

return 1;
}


public OnPlayerPickUpPickup(playerid, pickupid)
{
if (pickupid == 1273)
{
new string[25];
format(string,sizeof string,"you are standing in pickup %s",name);
SendClientMessage(playerid,0xFF0000AA,string);
}

return 1;
}



now theres the problem...im getting this error saying "error 017: undefined symbol "name""

the error is where it says "format". what im trying to do is i want it to get the name of the pickup (you will get the script when you take a look at it)

anyways...thanks
Reply
#2

You can use the code or pawn tags.

The function "CreateExample" is not a valid function.

Please visit the wiki for more help on scripting.

SAMP wiki
Reply
#3

Quote:
Originally Posted by EllipseRage
Посмотреть сообщение
You can use the code or pawn tags.

The function "CreateExample" is not a valid function.

Please visit the wiki for more help on scripting.

SAMP wiki
um.i dont understand


the function works because i created it....i even tried it out in the server and it works...


i just need to know how to retrive the information from "name"
Reply
#4

"name" is usually.

GetPlayerName(playerid, name, sizeof(name));
Reply
#5

Quote:
Originally Posted by EllipseRage
Посмотреть сообщение
"name" is usually.

GetPlayerName(playerid, name, sizeof(name));
Sorry to say this, but you should probably stop posting. All you are doing is confusing this guy. No disrespect intended.


@OP

Whats the shock? You're trying to use a parameter outside of the function's scope. Its like trying to use "playerid" inside of OnGameModeInit lol, you're pretty much hoping pawn can read your mind.

Why even have this message sent to players btw? You have a 3dTextLabel explaining what the pickup is, they can see the pickup, why would they need a third method of identifying the pickup?
Reply
#6

Quote:
Originally Posted by Kyosaur
Посмотреть сообщение
Sorry to say this, but you should probably stop posting. All you are doing is confusing this guy. No disrespect intended.


@OP

Whats the shock? You're trying to use a parameter outside of the function's scope. Its like trying to use "playerid" inside of OnGameModeInit lol, you're pretty much hoping pawn can read your mind.

Why even have this message sent to players btw? You have a 3dTextLabel explaining what the pickup is, they can see the pickup, why would they need a third method of identifying the pickup?

well im doing this so it opens up a path for me to identify a pickup's name

its pretty useful esspesially when when you are making your own house system...

i kinda saw this idea in a tutorial but since the tutorial has some flaws...i decided to make my own...


so if i can identify the pickup's name...then i can identify anything that i need to identify in the future... (i hope you understand)

so im just asking for a small hint on how to identify..that...

thx mate
Reply
#7

Quote:
Originally Posted by Kyosaur
Посмотреть сообщение
Sorry to say this, but you should probably stop posting. All you are doing is confusing this guy. No disrespect intended.


@OP

Whats the shock? You're trying to use a parameter outside of the function's scope. Its like trying to use "playerid" inside of OnGameModeInit lol, you're pretty much hoping pawn can read your mind.

Why even have this message sent to players btw? You have a 3dTextLabel explaining what the pickup is, they can see the pickup, why would they need a third method of identifying the pickup?
His asking me for it? I told him to learn something from the wiki.

Name for a pickup? Lolwhut. instead of putting "name" there , put pickupid.

So it would output something like this.

Код:
you are standing in pickup 1273
Reply
#8

Quote:
Originally Posted by Owenlishious
Посмотреть сообщение
well im doing this so it opens up a path for me to identify a pickup's name

its pretty useful esspesially when when you are making your own house system...

i kinda saw this idea in a tutorial but since the tutorial has some flaws...i decided to make my own...
Normally with house systems scripters make an array and just store the id of the pickup/checkpoint. If the pickup id matches one in their array, is obviously a house :P. If you want to go one step further and add businesses, you could check your pickup model id and base your message on that :P.

This method requires looping, but if you're clever you can completely cut them out.


Look into arrays either way, as there's really no way to do this without them :P.
Reply
#9

Quote:
Originally Posted by EllipseRage
Посмотреть сообщение
His asking me for it? I told him to learn something from the wiki.

Name for a pickup? Lolwhut. instead of putting "name" there , put pickupid.

So it would output something like this.

Код:
you are standing in pickup 1273
if you look closely to the code...i made a unique name for each pickup such as "pickup 1 "pickup 2" and "pickup 3"

so i dont think pickupid will work
Reply
#10

Quote:
Originally Posted by Kyosaur
Посмотреть сообщение
Normally with house systems scripters make an array and just store the id of the pickup/checkpoint. If the pickup id matches one in their array, is obviously a house :P. If you want to go one step further and add businesses, you could check your pickup model id and base your message on that :P.

This method requires looping, but if you're clever you can completely cut them out.


Look into arrays either way, as there's really no way to do this without them :P.
oh i never thought of using arrays ;o

crap i think i know now XD

thx dude
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)