SA-MP Forums Archive
Little coding questions - For general minor queries 5 - 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)
+--- Thread: Little coding questions - For general minor queries 5 (/showthread.php?tid=30938)



Re: Little coding questions - For general minor queries 5 - Backwardsman97 - 16.04.2008

I'm working with a mode that uses mini games and I'm trying to think of how to check if all of one team, or in last man standing, if all but one player gets eliminated in mini games. I just can't really think of how. It's there but I can't think of it. Would something like this work? http://pastebin.thegtaplanet.net/pastebin.php?show=450


Re: Little coding questions - For general minor queries 5 - Cactus - 19.04.2008

Ha, extremely small question here:

What's the sound ID for the little song that plays when you purchase a house/asset in single-player?

Internets and cookie to the one who finds it. I'm pretty sure it's the same one as the mission success jingle.


Re: Little coding questions - For general minor queries 5 - mamorunl - 25.07.2008

Hey guys,

I've got a little problem. I have a login command which does not execute the following line:

pawn Code:
#define PlayerFile "Players/%s.nt"

format(fname,sizeof(fname),PlayerFile,udb_encode(playername));
The problem is, I think, in the udb_encode part but I can't seem to figure out how that is causing it.





Re: Little coding questions - For general minor queries 5 - matt2127 - 25.07.2008

so does that code right there load the file or does it itself?

i usually have like for houses example load bizz

which means to load my bizz.cfg in my scriptfiles


Re: Little coding questions - For general minor queries 5 - mamorunl - 25.07.2008

can you explain yourself a little bit better, I don't know what you are saying..


Re: Little coding questions - For general minor queries 5 - matt2127 - 25.07.2008

ok well in my script when im loading something outside of my GM ok?


i have a few lines like

Load bizz

which will load my bizz.cfg in my scriptfiles

so maybe with your login stuff if you have a file

do fuctions such as

load (file name for players registered here)

then whatever else is supposed to be there with your player login system

i will ad i highly doubt this will work i have never tested it


Re: Little coding questions - For general minor queries 5 - mamorunl - 26.07.2008

no its into the command itself.

pawn Code:
if(!strlen(params))
    {
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /login [password]");
    }
    else
    {
      format(fname,sizeof(fname),PlayerFile,udb_encode(playername));
      print("0.4");
        if (fexist(fname)) {
but it doesn't print 0.4


Re: Little coding questions - For general minor queries 5 - gatokpo - 26.07.2008

When the error is "undefined symbol: x".
What i have to do?
The script im doing is:
if (strcmp("/allah", cmdtext, true) == 0)
GetPlayerPos(playerid, x, y, z);
CreateExplosion(x, y, z, 3, 10);
{

return 1;
}
return 0;
}

I know its possible really bad... and you are possibly lauhging about it...
Im not too good at scripting.


Re: Little coding questions - For general minor queries 5 - dahmer - 26.07.2008

How do I force a player to run a command?
Since the command isnt a function I simply just can not run: myfunction(playerid);
So who do I make a player run the command "/info" automatic?

EDIT:
I found a way:

OnPlayerCommandText(playerid,"/info");


Re: Little coding questions - For general minor queries 5 - mamorunl - 27.07.2008

Quote:
Originally Posted by gatokpo
When the error is "undefined symbol: x".
What i have to do?
The script im doing is:
if (strcmp("/allah", cmdtext, true) == 0)
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreateExplosion(x, y, z, 3, 10);
{

return 1;
}
return 0;
}

I know its possible really bad... and you are possibly lauhging about it...
Im not too good at scripting.
you need to define X, Y and Z


Re: Little coding questions - For general minor queries 5 - Orpheus - 27.07.2008

Quick Question, Pointless in searching for such a random thing, as the search params could be UNBELIEVABLY random

IS it possible to make an array read from a MAX point and a MIN point , so if you wanted to shorted an array for your WEATHER array, is it possible to mkae it loop from MAX weather to MIN weather?
so if the MAX u wanted was 46 and the MIN you wanted was 1?

if so how would you do it? would it be the basic loop?


Re: Little coding questions - For general minor queries 5 - mamorunl - 27.07.2008

well, as you actually said the answer yourself, you could make a timer with a random() function


Re: Little coding questions - For general minor queries 5 - gatokpo - 27.07.2008

Quote:
Originally Posted by Orpheus
if line 140 is a return 1; then its because it outisde your main brackets ;0 e.g u probably have
return 1;
}

too much

Regards Orph
So... how to fix it? :P.
Thanks for the other part , it worked



Re: Little coding questions - For general minor queries 5 - gatokpo - 27.07.2008

Cause the only error i have is:
error 003: declaration of a local variable must appear in a compound block


Re: Little coding questions - For general minor queries 5 - mamorunl - 28.07.2008

you probably have the new Float ... etc OUTSIDe the command or even outside the braces { ... }


Re: Little coding questions - For general minor queries 5 - gatokpo - 28.07.2008

Look what exacly i have is this:

if (strcmp("/allah", cmdtext, true) == 0)
new Float;
new Float:y;
new Float:z;
GetPlayerPos(playerid, x, y, z);
CreateExplosion(x, y, z, 3, 10);
{

return 1;
}
return 0;
}

...
Tell me wahts wrong please :S.
Btw thanks for answering all my noob questions


Re: Little coding questions - For general minor queries 5 - mamorunl - 29.07.2008

if (strcmp("/allah", cmdtext, true) == 0) {
new Float;
new Float:y;
new Float:z;
GetPlayerPos(playerid, x, y, z);
CreateExplosion(x, y, z, 3, 10);

return 1;
}
return 0;
}

you opened your command after the explosion, an IF statement should be opened with a bracet.. read the pawn-lang.pdf


Re: Little coding questions - For general minor queries 5 - acade - 30.07.2008

In Debug, what is the command to spawn a car?

also, We want WIKI back


Re: Little coding questions - For general minor queries 5 - Orpheus - 30.07.2008

WIki Backup
one of the many backups for those who need it


Re: Little coding questions - For general minor queries 5 - [AoD]Hoodlum - 30.07.2008

Quote:
Originally Posted by MATT11504
im having trouble using GetPlayerWeapon.
weaponid = GetPlayerWeapon(playerid)
if (weaponid = 35)
{
SendClientMessage(playerid,COLOR_RED,"TEST");
}
but it says the weaponid = line is an invalid function or decleration and the same for l the if (weaponid = 35) line
any examples of how GetPlayerWeapon is used?
It should be called like this
new weaponid = GetPlayerWeapon(playerid);
if(weaponid == 35) {
SendClientMessage(playerid,COLOR_RED,"Test");
}

You forgot to implement the closing statement on GetPlayerWeapon, and forgot to assign weaponid as a new variable, also you forgot to add the other '=' sign into the IF statement therefore it won't compile properly.
Bye;]